package rs.mbs2.epics.server.servlet.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

public class Parse {

	public static String pattern = "yyyy-MM-dd";
	
	public static Date parseDate(String dateString) throws ParseException {
		Date retVal = new SimpleDateFormat(pattern, Locale.getDefault()).parse(dateString);
		return retVal;
	}
	
	public static Set<String> parseCommaSeparatedStrings(String text) {
		Set<String> retVal = new HashSet<>();
		
		String[] separated = text.split(",");
		for(String s : separated) {
			retVal.add(s.trim());
		}
		
		return retVal;
	}
	
}
